<?php
if(md5($_POST["password"]) == "bd557c2474e61ee1e139c382a4ddf605"){
	require_once 'connect.php';
	
	try {
		
		$sth = $pdo->query("UPDATE news SET title='".str_replace("'","\'",$_POST["title"])."' ,
				summary='".str_replace("'","\'",$_POST["summary"])."',
				content='".str_replace("'","\'",$_POST["newsContent"])."',
				image='".$_POST["image"]."',
				category='".$_POST["category"]."'
				WHERE news_id='".$_POST["news_id"]."'");
		
		echo "ok! <a href='../Pages/latestNews.php'>Retour</a>";
	} catch (PDOException $e) {
		echo $e;
	}
}else{
		echo "Wrong password ! <a href='../Pages/modifyNews.php'>retour</a>";
	}
?>